/// <reference path="../../../../assets/jsplugin/core.js" />
/*
 * loader plugin config to default skin
 * v0.2
 * by Hunter
 * CopyRight 2016-02-29
 */
var thisConfig = {
    path: {
        sysSyle: '../assets/style', 
        sysPlugin: '../assets/jsplugin/', 
        skin: '../themes/', 
        tplURI: "modules/",  
        uxURI: 'ux/', 
        festival: ''
    },
    version: "_v=20171110",										// 时间戳,发布时需修改
	_urls: {
		WebPath: '',
        ServicePath: 'http://test.wangyuebashi.com/',			// 数据接口地址，发布时需修改为：/
//		ServicePath: 'http://localhost:805/',			// 数据接口地址
//		ServicePath: 'http://10.20.0.11:8080/',			// 数据接口地址
    	Context: '/wybashi',
    	ROOT: '/src'										// 根目录，发布时需修改为：/webapp
	}
};
(function () {
    "use strict";
    var script = document.getElementById("require");
    var catalog = script.getAttribute('data-catalog');
    var T = function (_obj) {
        require.config({
            urlArgs: thisConfig.version,
            paths: _obj.JSPATH,
            map: { '*': { 'css': thisConfig.path.sysPlugin + '/css.min.js' } },
            waitSeconds: 0,
            shim: _obj.SHIM
        });
        require(CfgObj.MAIN, function ($) {
            jQuery.extend(App, { pathCfg: thisConfig.path, versionCfg: thisConfig.version, _urlsCfg: thisConfig._urls, rootCfg: thisConfig._urls });
            App.drawAppView(thisConfig.path.skin + thisConfig.path.tplURI + catalog + App.pathname.tplfile, function () {
                require([App.pathname.file], function () {
                    var fn = Page['init'];
                    if (typeof fn === 'function') {
                        fn.apply();
                        App.loading(true);
                    }
                });
            });
        });
    };
    var CfgObj = new Object();
    var getDevConfig = function () {
        var urlArr = window.location.href.split("#")
        var arrUrl = urlArr[0].split("/");
        var arrName = arrUrl[arrUrl.length - 1].split(".");
        var JSPATH = new Object();
        JSPATH['jquery'] = thisConfig.path.sysPlugin + 'jquery-1.11.1.min.js';
        JSPATH['layer'] = thisConfig.path.sysPlugin + 'layer/layer.js';
        JSPATH['amazeui'] = thisConfig.path.sysPlugin + 'amazeui.min.js';
        JSPATH['layerext'] = thisConfig.path.sysPlugin + 'layer/extend/layer.ext.js';
        JSPATH['bootstrap'] = thisConfig.path.sysPlugin + 'bootstrap.min.js';
        JSPATH['app1'] = thisConfig.path.sysPlugin + 'app1.js';
        JSPATH['select2'] = thisConfig.path.sysPlugin + 'select2.js';
        JSPATH['select2_zhCN'] = thisConfig.path.sysPlugin + 'select2_locale_zh-CN.js';
        JSPATH['autocomplete'] = thisConfig.path.sysPlugin + 'jquery.autocomplete.js';
        JSPATH['laypage'] = thisConfig.path.sysPlugin + 'laypage/laypage.js';
        JSPATH['laydate'] = thisConfig.path.sysPlugin + 'laydate/laydate.js';
        JSPATH['daterangepicker'] = thisConfig.path.sysPlugin + 'jquery.daterangepicker.js';
        JSPATH['clockpicker'] = thisConfig.path.sysPlugin + 'bootstrap-clockpicker.min.js';
        JSPATH['inputmask'] = thisConfig.path.sysPlugin + 'input-mask/jquery.inputmask.bundle.js';
        JSPATH['echarts'] = thisConfig.path.sysPlugin + 'echarts.min.js';
        JSPATH['moment'] = thisConfig.path.sysPlugin + 'moment.min.js';
        JSPATH['qswhGB2312'] = thisConfig.path.sysPlugin + 'qswhGB2312.js';
        JSPATH['core'] = 'core.js';
        JSPATH['menu'] = 'menu.js';
        JSPATH[arrName[0]] = thisConfig.path.skin + thisConfig.path.uxURI + arrName[0] + '.js';
        var CSSDEPS = {
            // index: ['css!' + thisConfig.path.skin + 'res/build-style/vp.css', 'css!' + thisConfig.path.skin + 'res/build-style/indexstyle.css'],
            index: [
                'css!' + thisConfig.path.sysSyle + '/bootstrap.min',
                'css!' + thisConfig.path.sysSyle + '/ionicons.min',
                'css!' + thisConfig.path.sysSyle + '/font-awesome.min',
                'css!' + thisConfig.path.sysSyle + '/amazeui',
                'css!' + thisConfig.path.sysSyle + '/select2/select2',
                'css!' + thisConfig.path.sysSyle + '/select2/select2_metro',
                'css!' + thisConfig.path.sysSyle + '/layer/skin/layer',
                'css!' + thisConfig.path.sysSyle + '/laypage/skin/laypage',
                'css!' + thisConfig.path.sysSyle + '/laydate/skins/default/laydate',
                'css!' + thisConfig.path.sysSyle + '/layer/skin/layer.ext',
                'css!' + thisConfig.path.sysSyle + '/simplify',
                'css!' + thisConfig.path.sysSyle + '/xtt'
            ]
        };
        var SHIM = {
            'jquery': CSSDEPS[catalog],
            "amazeui": { deps: ['jquery'] },
            "bootstrap": { deps: ['jquery'] },
            "autocomplete": { deps: ['jquery'] },
            "core": { deps: ['jquery'] },
            "layer": { deps: ['jquery'] },
            "layerext": { deps: ['jquery','layer'] },
            "daterangepicker": { deps: ['jquery'] },
            "clockpicker": { deps: ['jquery'] },
            "inputmask": { deps: ['jquery'] },
            "echarts": { deps: ['jquery'] },
            'laypage': { deps: ['jquery','layer'] },
            'laydate': { deps: ['jquery','layer'] },
            "app1": { deps: ['jquery'] },
            "select2": { deps: ['jquery','app1'] },
            "select2_zhCN": { deps: ['jquery','select2','app1'] }
        };
        CfgObj['JSPATH'] = JSPATH;
        CfgObj['CSSDEPS'] = CSSDEPS;
        CfgObj['SHIM'] = SHIM;
        CfgObj['MAIN'] = ['jquery', 'bootstrap', 'app1', 'select2', 'select2_zhCN', 'amazeui', 'autocomplete', 'layer', 'layerext', 'daterangepicker', 'clockpicker', 'laypage', 'laydate', 'inputmask', 'echarts', 'core','qswhGB2312'];
        T(CfgObj);
    }();
})()
